﻿@using BlueLotus7.Eden.KB.Status.Models;
@using BlueLotus7.ArchiveSystem.Common;
@using BlueLotus7.Eden.Web;
@model StatusGridControlModel
@{
    if (Model != null)
    {
        string tableId = "statusGrid" + (Model.DomainScopeKey.ToString() + "_" + Model.DomainScopeUserKey.ToString()).Replace('-', '_');
    <text>
    <table id="@(tableId)" cellpadding="0" cellspacing="0" class="bluelotus7-grid">
        <thead>
            <tr>
                @{
           if (Model.Mergable)
           {
                    <text>
                    <th class="selectable">
                        &nbsp;
                    </th>
                    </text>
           }
                }
                <th class="start">
                    From
                </th>
                <th class="end">
                    To
                </th>
                <th class="status">
                    Status
                </th>
            </tr>
        </thead>
        <tbody>
            @{
           foreach (TargetStatus item in Model.TargetStatusList)
           {
               var statusText = Enum.Parse(Model.EnumType, item.Status.ToString()).ToString().ToLowerInvariant();
                <text>
                <tr>
                    @{ 
               if (Model.Mergable)
               {
                        <text>
                        <td class="selectable">
                            <input type="checkbox" value="@(item.Key.ToString())" />
                        </td>
                        </text>
               }
                    }
                    <td class="start">
                        @(Helper.DateTimeToString(item.StartStamp))
                    </td>
                    <td class="end">
                        @(Helper.DateTimeToString(item.EndStamp))
                    </td>
                    <td class="status @(statusText)">
                        @(statusText)
                    </td>
                </tr>
                </text>
           }
            }
        </tbody>
    </table>
    </text>

    }  
}
